package pub.guoxin.oops.utils;

/**
 * Created by guoxin on 17-11-15.
 */
public class RandomUtils {

    private static final int TEN = 10;

    /**
     * 过得length位的随机数
     *
     * @param length 位数
     * @return 随机数
     */
    public static String random(int length) {
        int tmp = TEN;
        for (int i = 1; i < length; i++) {
            tmp *= TEN;
        }
        return String.valueOf((int) (Math.random() * tmp));
    }

    public static void main(String[] args) {
        System.out.println(random(6));
    }
}
